﻿using System.Windows;
using Riba.MVVMSL;

namespace TestGUI
{
	public class Page1ViewModel : ViewModelBase
	{
		public RelayCommand CommandMouseEnter { get; private set; }

		public Page1ViewModel()
		{
			CommandMouseEnter = new RelayCommand(OnMouseEnter) { IsEnabled = true };

			ExchangeDataAvailable += Page1ViewModel_ExchangeDataAvailable;
		}

		void Page1ViewModel_ExchangeDataAvailable(object sender, ExchangeDataAvailableEventArgs e)
		{
			ExchangeDataDictionary["CurrentPage"] = typeof (Page1);
			PropertyChanged += Page1ViewModel_PropertyChanged;
			var p = e.ParentVM;
		}

		void Page1ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
		{
			IsDirty = true;
		}

		public void OnMouseEnter(object commandParameter)
		{
			RaiseShowMsgBox(new ShowMsgBoxEventArgs(string.Format("Mouse entered with '{0}'", commandParameter), "MSG", MessageBoxButton.OK));
		}
	}
}
